home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / rockridge / tools / system / classes / DontDoThisAtHomeKids.java < prev    next >
Encoding:
Java Source  |  1995-11-13  |  479 b   |  23 lines

  1. import java.io.*;
  2.  
  3. class DontDoThisAtHomeKids {
  4.  
  5.     public static void main(String args[]) {
  6.     String osname = System.getOSName();
  7.     InputStream is = null;
  8.     StringBuffer buf = new StringBuffer();
  9.     int c;
  10.  
  11.     if (osname.equals("Solaris")) {
  12.         is = System.execin("pwd");
  13.     } else if (osname.equals("Win32")) {
  14.         is = System.execin("cd");
  15.     }
  16.     if (is != null) {
  17.         while ((c = is.read()) != -1)
  18.             buf.appendChar((char)c);
  19.         System.out.print(buf.toString());
  20.     }
  21.     }
  22. }
  23.